package priv.yiyuan.example.design.pay;

import java.util.HashMap;
import java.util.Map;

/**
 * 支付宝支付
 * <p>
 * 抽象子类
 */
public class AliPayPayment extends Payment {

    private String aliPayAccount;

    public AliPayPayment(PaymentProcessor paymentProcessor, String aliPayAccount) {
        super(paymentProcessor);
        this.aliPayAccount = aliPayAccount;
    }

    @Override
    public boolean makePayment(double amount) {

        Map<String, String> details = new HashMap<>();
        details.put("aliPayAccount", aliPayAccount);

        return paymentProcessor.processPayment(amount, details);
    }

    @Override
    public boolean requestRefund(double amount) {
        return paymentProcessor.refund(amount, super.getTransactionId());
    }
}
